From: emellor@ewan Date: Wed, 28 Sep 2005 12:41:44 +0000 (+0100) Subject: Handle exceptions caused during processing of requests, to improve error X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16769^2~16^2~24 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d391a2dddc20e4b8199b07f52e224eab60812c69;p=xen.git Handle exceptions caused during processing of requests, to improve error reporting. Signed-off-by: Ewan Mellor --- diff --git a/tools/python/xen/web/SrvBase.py b/tools/python/xen/web/SrvBase.py index 49a9e058d1..e0b528fcc0 100644 --- a/tools/python/xen/web/SrvBase.py +++ b/tools/python/xen/web/SrvBase.py @@ -81,7 +81,14 @@ class SrvBase(resource.Resource): req.write("Operation not implemented: " + op) return '' else: - return op_method(op, req) + try: + res = op_method(op, req) + except Exception, exn: + log.exception("Request %s failed.", op) + if req.useSxp(): + return ['xend.err', "Exception: " + str(exn)] + else: + return "

%s

" % str(exn) def print_path(self, req): """Print the path with hyperlinks.